package com.wn.class30.service.impl;

import com.wn.class30.entity.Systemmenu;
import com.wn.class30.mapper.SystemmenuDao;
import com.wn.class30.service.SystemmenuService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashSet;
import java.util.List;
@Service
public class SystemmenuServiceImpl implements SystemmenuService {
    @Resource
    private SystemmenuDao systemmenuDao;
    @Override
    public HashSet<Systemmenu> queryPressionByUserInfo(Integer adminUserId) {
        List<Systemmenu> rolePermissions = systemmenuDao.selectRolePermissionsByUser(adminUserId);
        HashSet<Systemmenu> Permissions  = new HashSet<Systemmenu>();
        for (int i = 0; i < rolePermissions.size(); i++) {
            if(rolePermissions.get(i)!=null&&rolePermissions.get(i).getMenuId()!=null) {
                Permissions.add(rolePermissions.get(i));
            }
        }
        return Permissions;
    }
}
